Ending Data Collection

After you are finished collecting data for a query, call the PdhCloseQueryKKQKMT function to close the query and release all allocated system resources. The function closes all counter handles associated with the query.